package storage.statistics;

import storage.beans.Region;

public class MeanRegionStatistic extends Statistic {
  private Region region;
  private int temperature;
  
  public MeanRegionStatistic(int temperature, Region region) {
    super(StatisticType.MEAN_TEMP_REGION);
    this.region = region;
    this.temperature = temperature;
  }
  
  public MeanRegionStatistic(String value) {
    super(StatisticType.MEAN_TEMP_REGION, value);
  }
  
  public String getHtmlString() {
    String html = "<b>Mean Temperature over Region: </b>";
    return html;
  }  
  
  public String getStatValues() {
    String values = temperature + SEP + 
                    region.getLongEast() + SEP + 
                    region.getLongWest() + SEP + 
                    region.getLatNorth() + SEP + 
                    region.getLatSouth() + SEP;
    return values;
  }
  
  public void setStatValue(String value) {
    String[] values = value.split(SEP);
    temperature = Integer.parseInt(values[0]);
    int longEast = Integer.parseInt(values[1]);
    int longWest = Integer.parseInt(values[2]);
    int latNorth = Integer.parseInt(values[3]);
    int latSouth = Integer.parseInt(values[4]);
    region = new Region(longWest, longEast, latNorth, latSouth); 
  }

}
